<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<input type="button"  id="bt1" value="点击开始计时" />
		<p>点击上面按钮开始多次计时</p>
		<input type="button"  id="bt2" value="点击停止计时" />
		<p>点击上面按钮停止多次计时</p>
	</body>
	<script type="text/javascript">
		var obt1 = document.getElementById("bt1")
		var obt2 = document.getElementById("bt2")
		var t;
		obt1.onclick = function(){t = setInterval(
				function(){
					alert("爆炸")
				},2000
			)
		}
		obt2.onclick = function(){
			clearInterval(t)
		}
	</script>
</html>
